package com.crmxconsumer.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.pojo.User;
import com.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@CrossOrigin //(origins = {"http://localhost:8088/"})//跨域
public class IndexController {

    @RequestMapping("/index")
    public String getindex(Model model){
        model.addAttribute("shuo","数据传输正常");
        return "index";
    }


    @Reference
    private UserService userService ;

    @RequestMapping("/userList")
    public String getUserList(Model model) {
        List<User> userlist=userService.getUserList();
        model.addAttribute("userlist",userlist);
        return "index";
    }

   /* @RequestMapping("/userList")
    public List<User> getUserList() {
        return userService.getUserList() ;
    }*/


}
